<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <input type="text" value="0">
    </div>
</body>

</html>
<style>
    div{
        width: 20PX;
        height: 20PX;
        margin: 0 auto;
    }
    input {
        width: 20px;
        height: 20px;
        background-color: skyblue;
        text-align: center;
        line-height: 20px;
    }
</style>
<script>
    var ipt = document.querySelector("input")
    setInterval(sum, 1000);
    function sum() {
        ipt.value++
    }
    sum();
</script>